/* 
* Class name: GameSpace *
* 
* Version info: v4.0 *
* 
* Dscription: It creates the first game screen shows game menu to the user
* 
* Copyright by Group4 from CmpE450 course *
*/ 

package com.GameSpace.SameGame;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.GameSpace.CoreAssets.GameManager;
import com.GameSpace.CoreAssets.HighScoreManager;
import com.GameSpace.CoreAssets.OptionManager;
import com.GameSpace.SameGame.R;

public class GameSpace extends Activity {
	
	//The buttons in the first game screen
	ImageView StartGame;
	ImageView Help;
	ImageView Options;
	ImageView HighScores;

	private HighScoreManager highScoreManager;
	private OptionManager optionManager;
	
	@Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        
	        setContentView(R.layout.beforenewgame);
	        
	        StartGame = (ImageView)findViewById(R.id.imgStartNewGame);
	        System.out.println("gamespace onClick pressed");
	        
	        //click event handler for the start game buttons
	        StartGame.setOnClickListener(new OnClickListener() {
	        	
	        	public void onClick(View v) {
	        		
	        		System.out.println("gamespace onClick pressed");
	        		Intent StartGameIntent;
	        		
	        		//calls the select level class
	        		if(GameManager.getHasLevel())
	        			StartGameIntent = new Intent(GameSpace.this, SelectLevel.class);
	        		else
	        			StartGameIntent = new Intent(GameSpace.this, SelectLevel.class);
	        		startActivity(StartGameIntent);
	        	}
	        });
	        
	        Help  = (ImageView)findViewById(R.id.imgHowToPlay);
	        //click event handler for how to play button
	        Help.setOnClickListener(new OnClickListener() {
	        	
	        	public void onClick(View v) {
	        		
	        		//calls the how to play class
	        		Intent HelpIntent = new Intent(GameSpace.this, HowToPlay.class);
	        		startActivity(HelpIntent);
	        	}
	        });
	        
	        Options = (ImageView)findViewById(R.id.imgSettings);
	        //click event handler for options button
	        Options.setOnClickListener(new OnClickListener() {
	        	
	        	public void onClick(View v) {
	        		//calls options class
	        		Intent OptionsIntent = new Intent(GameSpace.this, Options.class);
	        		startActivity(OptionsIntent);
	        	}
	        	
	        });
	        
	        HighScores  = (ImageView)findViewById(R.id.imgHighScores);
	        //click event handler for highscore button
	        HighScores.setOnClickListener(new OnClickListener() {
	        	
	        	public void onClick(View v) {
	        		//calls highscore class
	        		Intent HighscoresIntent= new Intent(GameSpace.this,Highscores.class);
	        		startActivity(HighscoresIntent);
	        	}
	        });
	        
	        ImageView Logo;
	        Logo  = (ImageView)findViewById(R.id.ImgLogo);
	        //click event handler for other company logo button
	        Logo.setOnClickListener(new OnClickListener() {	        	
	        	public void onClick(View v) {
	        		//click the class of the screen which shows other games of the company
	        		Intent GameAdsIntent= new Intent(GameSpace.this,GameAds.class);
	        		startActivity(GameAdsIntent);
	        	}
	        });
	  }

	//starts the game menu
    public void startApplication(){
		showMainMenu();
	}
    
    //shows the game menu on the screen
	public void showMainMenu(){
		Log.e("a","b");
		setContentView(R.layout.beforenewgame);        
	}
	
	//shows how to play screen
	public void showHowToPlay(){
		Intent HelpIntent = new Intent(GameSpace.this, HowToPlay.class);
		startActivity(HelpIntent);
	}
	
	//shows other games screen
	public void showMoreGames(){
		Intent moreGamesIntent= new Intent(GameSpace.this, GameAds.class);
		startActivity(moreGamesIntent);
	}
	
	//gets high score manager
	public HighScoreManager getHighScoreManager(){
		return this.highScoreManager;
	}
	//sets high score manager
	public void setHighScoreManager(HighScoreManager value){
		this.highScoreManager = value;
	}
	
	//gets the option manager
	public OptionManager getOptionManager(){
		return this.optionManager;
	}
	
	//sets the option manager
	public void setOptionManager(OptionManager value){
		this.optionManager = value;
	}
}